import React, { useState, useEffect } from 'react';
import { createDomain, checkDomainName, getHostResources, listStoragePools, listNetworks } from '../api/client';

interface CreateVMWizardProps {
  isOpen: boolean;
  onClose: () => void;
  onSuccess: (vm: any) => void;
}

interface VMFormData {
  // Step 1: Basic Info
  name: string;
  description: string;
  osType: string;
  osVersion: string;

  // Step 2: Resources
  vcpus: number;
  memory: number;
  memoryUnit: 'MB' | 'GB';
  cpuMode: string;

  // Step 3: Storage
  storagePool: string;
  diskSize: number;
  diskFormat: string;
  diskBus: string;
  cacheMode: string;
  isoPath: string;
  isoType: 'local' | 'url' | 'template';

  // Step 4: Network
  networkType: string;
  networkName: string;
  networkModel: string;
  macAddress: string;

  // Step 5: Boot Options
  bootOrder: string[];
  autostart: boolean;
  bootDelay: number;
  loader: string;
  graphics: string;
  displayProtocol: string;
}

const CreateVMWizard: React.FC<CreateVMWizardProps> = ({ isOpen, onClose, onSuccess }) => {
  const [currentStep, setCurrentStep] = useState(1);
  const [formData, setFormData] = useState<VMFormData>({
    // 默认值
    name: '',
    description: '',
    osType: 'linux',
    osVersion: 'ubuntu22.04',
    vcpus: 2,
    memory: 2048,
    memoryUnit: 'MB',
    cpuMode: 'host-model',
    storagePool: 'default',
    diskSize: 20,
    diskFormat: 'qcow2',
    diskBus: 'virtio',
    cacheMode: 'writeback',
    isoPath: '',
    isoType: 'local',
    networkType: 'nat',
    networkName: 'default',
    networkModel: 'virtio',
    macAddress: '',
    bootOrder: ['cdrom', 'hd'],
    autostart: false,
    bootDelay: 0,
    loader: 'uefi',
    graphics: 'virtio',
    displayProtocol: 'vnc'
  });

  const [isSubmitting, setIsSubmitting] = useState(false);
  const [errors, setErrors] = useState<Record<string, string>>({});
  const [hostResources, setHostResources] = useState<any>(null);
  const [storagePools, setStoragePools] = useState<any[]>([]);
  const [networks, setNetworks] = useState<any[]>([]);
  const [nameAvailable, setNameAvailable] = useState<boolean | null>(null);
  const [isCheckingName, setIsCheckingName] = useState(false);

  const totalSteps = 5;

  // 加载初始化数据
  useEffect(() => {
    if (isOpen) {
      loadInitialData();
      generateMACAddress();
    }
  }, [isOpen]);

  // 检查名称可用性
  useEffect(() => {
    if (formData.name.trim()) {
      checkNameAvailability(formData.name.trim());
    } else {
      setNameAvailable(null);
    }
  }, [formData.name]);

  const loadInitialData = async () => {
    try {
      const [resourcesRes, poolsRes, networksRes] = await Promise.all([
        getHostResources(),
        listStoragePools(),
        listNetworks()
      ]);

      setHostResources(resourcesRes.data);
      setStoragePools(poolsRes.data.pools || []);
      setNetworks(networksRes.data.networks || []);
    } catch (error) {
      console.error('Failed to load initial data:', error);
    }
  };

  const generateMACAddress = () => {
    const mac = '52:54:00' + Array.from({length: 3}, () =>
      Math.floor(Math.random() * 256).toString(16).padStart(2, '0')
    ).join(':');
    setFormData(prev => ({ ...prev, macAddress: mac }));
  };

  const checkNameAvailability = async (name: string) => {
    setIsCheckingName(true);
    try {
      const response = await checkDomainName(name);
      setNameAvailable(response.data.available);
    } catch (error) {
      setNameAvailable(false);
    } finally {
      setIsCheckingName(false);
    }
  };

  const handleNext = () => {
    if (validateCurrentStep()) {
      if (currentStep < totalSteps) {
        setCurrentStep(currentStep + 1);
      } else {
        handleSubmit();
      }
    }
  };

  const handlePrevious = () => {
    if (currentStep > 1) {
      setCurrentStep(currentStep - 1);
    }
  };

  const validateCurrentStep = (): boolean => {
    const newErrors: Record<string, string> = {};

    switch (currentStep) {
      case 1: // Basic Info
        if (!formData.name.trim()) {
          newErrors.name = '虚拟机名称不能为空';
        } else if (!/^[a-zA-Z0-9_-]+$/.test(formData.name)) {
          newErrors.name = '名称只能包含字母、数字、下划线和连字符';
        } else if (nameAvailable === false) {
          newErrors.name = '该名称已被使用';
        }
        if (!formData.osType) {
          newErrors.osType = '请选择操作系统类型';
        }
        break;

      case 2: // Resources
        if (formData.vcpus < 1 || formData.vcpus > 128) {
          newErrors.vcpus = 'CPU核心数必须在1-128之间';
        }
        if (formData.memory < 512) {
          newErrors.memory = '内存不能小于512MB';
        }
        if (hostResources && formData.memory > hostResources.memory.total * 0.8) {
          newErrors.memory = '内存不能超过宿主机总内存的80%';
        }
        break;

      case 3: // Storage
        if (formData.diskSize < 1) {
          newErrors.diskSize = '磁盘大小必须大于0';
        }
        if (formData.isoType === 'local' && !formData.isoPath.trim()) {
          newErrors.isoPath = '请选择ISO文件';
        }
        break;

      case 4: // Network
        if (formData.networkType === 'network' && !formData.networkName) {
          newErrors.networkName = '请选择虚拟网络';
        }
        if (formData.macAddress && !/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(formData.macAddress)) {
          newErrors.macAddress = 'MAC地址格式不正确';
        }
        break;
    }

    setErrors(newErrors);
    return Object.keys(newErrors).length === 0;
  };

  const handleSubmit = async () => {
    if (!validateCurrentStep()) return;

    setIsSubmitting(true);
    try {
      // 构建API请求数据
      const requestData = {
        name: formData.name,
        description: formData.description,
        os_type: formData.osType,
        os_version: formData.osVersion,
        cpu: {
          cores: formData.vcpus,
          mode: formData.cpuMode
        },
        memory: {
          size: formData.memory,
          unit: formData.memoryUnit.toLowerCase()
        },
        storage: {
          pool: formData.storagePool,
          size: formData.diskSize,
          format: formData.diskFormat,
          bus: formData.diskBus,
          cache: formData.cacheMode
        },
        iso: {
          type: formData.isoType,
          path: formData.isoPath
        },
        network: {
          type: formData.networkType,
          network: formData.networkName,
          model: formData.networkModel,
          mac: formData.macAddress
        },
        boot: {
          order: formData.bootOrder,
          autostart: formData.autostart,
          boot_delay: formData.bootDelay,
          loader: formData.loader
        },
        graphics: {
          type: formData.graphics,
          protocol: formData.displayProtocol
        }
      };

      const response = await createDomain(requestData);
      onSuccess(response.data);
      onClose();
      resetForm();
    } catch (error: any) {
      console.error('Failed to create VM:', error);
      setErrors({ submit: error.response?.data?.message || '创建虚拟机失败' });
    } finally {
      setIsSubmitting(false);
    }
  };

  const resetForm = () => {
    setCurrentStep(1);
    setFormData({
      name: '',
      description: '',
      osType: 'linux',
      osVersion: 'ubuntu22.04',
      vcpus: 2,
      memory: 2048,
      memoryUnit: 'MB',
      cpuMode: 'host-model',
      storagePool: 'default',
      diskSize: 20,
      diskFormat: 'qcow2',
      diskBus: 'virtio',
      cacheMode: 'writeback',
      isoPath: '',
      isoType: 'local',
      networkType: 'nat',
      networkName: 'default',
      networkModel: 'virtio',
      macAddress: '',
      bootOrder: ['cdrom', 'hd'],
      autostart: false,
      bootDelay: 0,
      loader: 'uefi',
      graphics: 'virtio',
      displayProtocol: 'vnc'
    });
    setErrors({});
    setNameAvailable(null);
    generateMACAddress();
  };

  const updateFormData = (field: keyof VMFormData, value: any) => {
    setFormData(prev => ({ ...prev, [field]: value }));
    // 清除对应字段的错误
    if (errors[field]) {
      setErrors(prev => {
        const newErrors = { ...prev };
        delete newErrors[field];
        return newErrors;
      });
    }
  };

  const renderStep = () => {
    switch (currentStep) {
      case 1:
        return <BasicInfoStep
          data={formData}
          onChange={updateFormData}
          errors={errors}
          nameAvailable={nameAvailable}
          isCheckingName={isCheckingName}
        />;
      case 2:
        return <ResourcesStep
          data={formData}
          onChange={updateFormData}
          errors={errors}
          hostResources={hostResources}
        />;
      case 3:
        return <StorageStep
          data={formData}
          onChange={updateFormData}
          errors={errors}
          storagePools={storagePools}
        />;
      case 4:
        return <NetworkStep
          data={formData}
          onChange={updateFormData}
          errors={errors}
          networks={networks}
          onGenerateMAC={generateMACAddress}
        />;
      case 5:
        return <BootOptionsStep
          data={formData}
          onChange={updateFormData}
        />;
      default:
        return null;
    }
  };

  if (!isOpen) return null;

  return (
    <div className="modal-overlay" onClick={onClose}>
      <div className="modal-content wizard-modal" onClick={(e) => e.stopPropagation()}>
        <div className="wizard-header">
          <h2>创建虚拟机</h2>
          <button className="modal-close" onClick={onClose}>✕</button>
        </div>

        <div className="wizard-progress">
          <div className="progress-bar">
            <div
              className="progress-fill"
              style={{ width: `${(currentStep / totalSteps) * 100}%` }}
            />
          </div>
          <div className="progress-steps">
            {Array.from({ length: totalSteps }, (_, i) => (
              <div
                key={i}
                className={`step-indicator ${i + 1 === currentStep ? 'active' : ''} ${i + 1 < currentStep ? 'completed' : ''}`}
              >
                {i + 1}
              </div>
            ))}
          </div>
        </div>

        <div className="wizard-body">
          {errors.submit && (
            <div className="error-message">
              <span>❌ {errors.submit}</span>
            </div>
          )}
          {renderStep()}
        </div>

        <div className="wizard-footer">
          <button className="secondary" onClick={onClose} disabled={isSubmitting}>
            取消
          </button>
          <button
            className="secondary"
            onClick={handlePrevious}
            disabled={currentStep === 1 || isSubmitting}
          >
            上一步
          </button>
          <button
            className="primary"
            onClick={handleNext}
            disabled={isSubmitting}
          >
            {isSubmitting ? '创建中...' : currentStep === totalSteps ? '创建' : '下一步'}
          </button>
        </div>
      </div>
    </div>
  );
};

// Step 1: 基本信息
interface BasicInfoStepProps {
  data: VMFormData;
  onChange: (field: keyof VMFormData, value: any) => void;
  errors: Record<string, string>;
  nameAvailable: boolean | null;
  isCheckingName: boolean;
}

const BasicInfoStep: React.FC<BasicInfoStepProps> = ({
  data,
  onChange,
  errors,
  nameAvailable,
  isCheckingName
}) => {
  const osTypes = [
    { value: 'linux', label: 'Linux' },
    { value: 'windows', label: 'Windows' },
    { value: 'other', label: '其他' }
  ];

  const osVersions = {
    linux: [
      { value: 'ubuntu22.04', label: 'Ubuntu 22.04 LTS' },
      { value: 'ubuntu20.04', label: 'Ubuntu 20.04 LTS' },
      { value: 'centos8', label: 'CentOS 8' },
      { value: 'centos7', label: 'CentOS 7' },
      { value: 'debian11', label: 'Debian 11' },
      { value: 'fedora36', label: 'Fedora 36' }
    ],
    windows: [
      { value: 'win11', label: 'Windows 11' },
      { value: 'win10', label: 'Windows 10' },
      { value: 'winserver2022', label: 'Windows Server 2022' },
      { value: 'winserver2019', label: 'Windows Server 2019' }
    ],
    other: [
      { value: 'freebsd', label: 'FreeBSD' },
      { value: 'openbsd', label: 'OpenBSD' },
      { value: 'other', label: '其他' }
    ]
  };

  return (
    <div className="wizard-step">
      <h3>基本信息</h3>
      <div className="form-group">
        <label className="form-label required">虚拟机名称</label>
        <div className="input-with-status">
          <input
            type="text"
            className={`form-input ${errors.name ? 'error' : ''}`}
            value={data.name}
            onChange={(e) => onChange('name', e.target.value)}
            placeholder="输入虚拟机名称"
          />
          {isCheckingName && <span className="input-status">🔄</span>}
          {nameAvailable === true && <span className="input-status success">✓</span>}
          {nameAvailable === false && <span className="input-status error">✗</span>}
        </div>
        {errors.name && <span className="error-text">{errors.name}</span>}
      </div>

      <div className="form-group">
        <label className="form-label">描述</label>
        <textarea
          className="form-textarea"
          value={data.description}
          onChange={(e) => onChange('description', e.target.value)}
          placeholder="输入虚拟机描述（可选）"
          rows={3}
        />
      </div>

      <div className="form-group">
        <label className="form-label required">操作系统类型</label>
        <select
          className={`form-select ${errors.osType ? 'error' : ''}`}
          value={data.osType}
          onChange={(e) => {
            onChange('osType', e.target.value);
            onChange('osVersion', osVersions[e.target.value as keyof typeof osVersions][0].value);
          }}
        >
          {osTypes.map(type => (
            <option key={type.value} value={type.value}>{type.label}</option>
          ))}
        </select>
        {errors.osType && <span className="error-text">{errors.osType}</span>}
      </div>

      <div className="form-group">
        <label className="form-label required">操作系统版本</label>
        <select
          className="form-select"
          value={data.osVersion}
          onChange={(e) => onChange('osVersion', e.target.value)}
        >
          {osVersions[data.osType as keyof typeof osVersions]?.map(version => (
            <option key={version.value} value={version.value}>{version.label}</option>
          ))}
        </select>
      </div>
    </div>
  );
};

// Step 2: 资源配置
interface ResourcesStepProps {
  data: VMFormData;
  onChange: (field: keyof VMFormData, value: any) => void;
  errors: Record<string, string>;
  hostResources: any;
}

const ResourcesStep: React.FC<ResourcesStepProps> = ({ data, onChange, errors, hostResources }) => {
  const memoryInMB = data.memoryUnit === 'GB' ? data.memory * 1024 : data.memory;
  const memoryPercentage = hostResources ? (memoryInMB / hostResources.memory.total) * 100 : 0;

  return (
    <div className="wizard-step">
      <h3>资源配置</h3>

      <div className="form-group">
        <label className="form-label required">CPU核心数</label>
        <div className="input-with-slider">
          <input
            type="number"
            className={`form-input ${errors.vcpus ? 'error' : ''}`}
            value={data.vcpus}
            onChange={(e) => onChange('vcpus', parseInt(e.target.value) || 1)}
            min="1"
            max="128"
          />
          <div className="resource-hint">
            宿主机CPU: {hostResources?.cpu.total || 0}核心
          </div>
        </div>
        {errors.vcpus && <span className="error-text">{errors.vcpus}</span>}
      </div>

      <div className="form-group">
        <label className="form-label required">内存大小</label>
        <div className="memory-input-group">
          <input
            type="number"
            className={`form-input ${errors.memory ? 'error' : ''}`}
            value={data.memory}
            onChange={(e) => onChange('memory', parseInt(e.target.value) || 512)}
            min="512"
          />
          <select
            className="form-select memory-unit"
            value={data.memoryUnit}
            onChange={(e) => onChange('memoryUnit', e.target.value)}
          >
            <option value="MB">MB</option>
            <option value="GB">GB</option>
          </select>
        </div>
        {errors.memory && <span className="error-text">{errors.memory}</span>}
        {hostResources && (
          <div className="memory-usage-bar">
            <div className="memory-usage-text">
              使用宿主机内存的 {memoryPercentage.toFixed(1)}%
            </div>
            <div className="memory-usage-progress">
              <div
                className={`memory-usage-fill ${memoryPercentage > 80 ? 'warning' : ''}`}
                style={{ width: `${Math.min(memoryPercentage, 100)}%` }}
              />
            </div>
          </div>
        )}
      </div>

      <div className="form-group">
        <label className="form-label">CPU模式</label>
        <select
          className="form-select"
          value={data.cpuMode}
          onChange={(e) => onChange('cpuMode', e.target.value)}
        >
          <option value="host-model">Host Model（推荐）</option>
          <option value="host-passthrough">Host Passthrough</option>
          <option value="custom">Custom</option>
        </select>
      </div>
    </div>
  );
};

// Step 3: 存储配置
interface StorageStepProps {
  data: VMFormData;
  onChange: (field: keyof VMFormData, value: any) => void;
  errors: Record<string, string>;
  storagePools: any[];
}

const StorageStep: React.FC<StorageStepProps> = ({ data, onChange, errors, storagePools }) => {
  return (
    <div className="wizard-step">
      <h3>存储配置</h3>

      <div className="form-group">
        <label className="form-label required">存储池</label>
        <select
          className="form-select"
          value={data.storagePool}
          onChange={(e) => onChange('storagePool', e.target.value)}
        >
          {storagePools.map(pool => (
            <option key={pool.name} value={pool.name}>
              {pool.name} ({(pool.available / 1024 / 1024 / 1024).toFixed(1)} GB 可用)
            </option>
          ))}
        </select>
      </div>

      <div className="form-group">
        <label className="form-label required">磁盘大小 (GB)</label>
        <input
          type="number"
          className={`form-input ${errors.diskSize ? 'error' : ''}`}
          value={data.diskSize}
          onChange={(e) => onChange('diskSize', parseInt(e.target.value) || 1)}
          min="1"
          max="2000"
        />
        {errors.diskSize && <span className="error-text">{errors.diskSize}</span>}
      </div>

      <div className="form-group">
        <label className="form-label">磁盘格式</label>
        <select
          className="form-select"
          value={data.diskFormat}
          onChange={(e) => onChange('diskFormat', e.target.value)}
        >
          <option value="qcow2">QCOW2（推荐，支持快照）</option>
          <option value="raw">RAW（性能更好）</option>
        </select>
      </div>

      <div className="form-group">
        <label className="form-label">磁盘总线</label>
        <select
          className="form-select"
          value={data.diskBus}
          onChange={(e) => onChange('diskBus', e.target.value)}
        >
          <option value="virtio">VirtIO（推荐）</option>
          <option value="sata">SATA</option>
          <option value="scsi">SCSI</option>
          <option value="ide">IDE</option>
        </select>
      </div>

      <div className="form-group">
        <label className="form-label required">ISO镜像</label>
        <div className="iso-type-selector">
          <label className="radio-label">
            <input
              type="radio"
              name="isoType"
              value="local"
              checked={data.isoType === 'local'}
              onChange={(e) => onChange('isoType', e.target.value)}
            />
            本地ISO文件
          </label>
          <label className="radio-label">
            <input
              type="radio"
              name="isoType"
              value="url"
              checked={data.isoType === 'url'}
              onChange={(e) => onChange('isoType', e.target.value)}
            />
            网络URL
          </label>
        </div>

        {data.isoType === 'local' && (
          <div className="file-input-group">
            <input
              type="text"
              className={`form-input ${errors.isoPath ? 'error' : ''}`}
              value={data.isoPath}
              onChange={(e) => onChange('isoPath', e.target.value)}
              placeholder="例如: /var/lib/libvirt/iso/ubuntu-22.04.iso"
            />
            <button className="file-browse-btn">浏览</button>
          </div>
        )}

        {data.isoType === 'url' && (
          <input
            type="url"
            className="form-input"
            value={data.isoPath}
            onChange={(e) => onChange('isoPath', e.target.value)}
            placeholder="输入ISO文件URL"
          />
        )}
        {errors.isoPath && <span className="error-text">{errors.isoPath}</span>}
      </div>
    </div>
  );
};

// Step 4: 网络配置
interface NetworkStepProps {
  data: VMFormData;
  onChange: (field: keyof VMFormData, value: any) => void;
  errors: Record<string, string>;
  networks: any[];
  onGenerateMAC: () => void;
}

const NetworkStep: React.FC<NetworkStepProps> = ({ data, onChange, errors, networks, onGenerateMAC }) => {
  return (
    <div className="wizard-step">
      <h3>网络配置</h3>

      <div className="form-group">
        <label className="form-label">网络类型</label>
        <select
          className="form-select"
          value={data.networkType}
          onChange={(e) => onChange('networkType', e.target.value)}
        >
          <option value="nat">NAT（推荐）</option>
          <option value="bridge">桥接</option>
          <option value="network">虚拟网络</option>
          <option value="none">无网络</option>
        </select>
      </div>

      {data.networkType === 'network' && (
        <div className="form-group">
          <label className="form-label required">虚拟网络</label>
          <select
            className={`form-select ${errors.networkName ? 'error' : ''}`}
            value={data.networkName}
            onChange={(e) => onChange('networkName', e.target.value)}
          >
            <option value="">选择虚拟网络</option>
            {networks.map(network => (
              <option key={network.name} value={network.name}>
                {network.name} ({network.type})
              </option>
            ))}
          </select>
          {errors.networkName && <span className="error-text">{errors.networkName}</span>}
        </div>
      )}

      <div className="form-group">
        <label className="form-label">网络模型</label>
        <select
          className="form-select"
          value={data.networkModel}
          onChange={(e) => onChange('networkModel', e.target.value)}
        >
          <option value="virtio">VirtIO（推荐）</option>
          <option value="e1000">Intel E1000</option>
          <option value="rtl8139">Realtek RTL8139</option>
          <option value="vmxnet3">VMXNET3</option>
        </select>
      </div>

      <div className="form-group">
        <label className="form-label">MAC地址</label>
        <div className="mac-input-group">
          <input
            type="text"
            className={`form-input ${errors.macAddress ? 'error' : ''}`}
            value={data.macAddress}
            onChange={(e) => onChange('macAddress', e.target.value)}
            placeholder="52:54:00:XX:XX:XX"
          />
          <button className="generate-mac-btn" onClick={onGenerateMAC}>
            生成
          </button>
        </div>
        {errors.macAddress && <span className="error-text">{errors.macAddress}</span>}
      </div>
    </div>
  );
};

// Step 5: 启动选项
interface BootOptionsStepProps {
  data: VMFormData;
  onChange: (field: keyof VMFormData, value: any) => void;
}

const BootOptionsStep: React.FC<BootOptionsStepProps> = ({ data, onChange }) => {
  return (
    <div className="wizard-step">
      <h3>启动选项</h3>

      <div className="form-group">
        <label className="form-label">启动顺序</label>
        <div className="boot-order-list">
          {data.bootOrder.map((device, index) => (
            <div key={device} className="boot-order-item">
              <span className="boot-order-number">{index + 1}</span>
              <span className="boot-order-device">
                {device === 'cdrom' ? '光驱' : device === 'hd' ? '硬盘' : '网络'}
              </span>
              <button
                className="boot-order-remove"
                onClick={() => onChange('bootOrder', data.bootOrder.filter(d => d !== device))}
              >
                ✕
              </button>
            </div>
          ))}
        </div>
        <div className="boot-order-add">
          <button
            className="secondary small"
            onClick={() => {
              const available = ['cdrom', 'hd', 'network'].filter(d => !data.bootOrder.includes(d));
              if (available.length > 0) {
                onChange('bootOrder', [...data.bootOrder, available[0]]);
              }
            }}
            disabled={data.bootOrder.length >= 3}
          >
            + 添加启动设备
          </button>
        </div>
      </div>

      <div className="form-group">
        <label className="form-label checkbox-label">
          <input
            type="checkbox"
            checked={data.autostart}
            onChange={(e) => onChange('autostart', e.target.checked)}
          />
          宿主机启动时自动启动此虚拟机
        </label>
      </div>

      <div className="form-group">
        <label className="form-label">引导加载器</label>
        <select
          className="form-select"
          value={data.loader}
          onChange={(e) => onChange('loader', e.target.value)}
        >
          <option value="uefi">UEFI（推荐）</option>
          <option value="bios">BIOS（传统）</option>
        </select>
      </div>

      <div className="form-group">
        <label className="form-label">显卡类型</label>
        <select
          className="form-select"
          value={data.graphics}
          onChange={(e) => onChange('graphics', e.target.value)}
        >
          <option value="virtio">VirtIO（推荐）</option>
          <option value="cirrus">Cirrus</option>
          <option value="qxl">QXL</option>
          <option value="vga">VGA</option>
        </select>
      </div>

      <div className="form-group">
        <label className="form-label">显示协议</label>
        <select
          className="form-select"
          value={data.displayProtocol}
          onChange={(e) => onChange('displayProtocol', e.target.value)}
        >
          <option value="vnc">VNC（推荐）</option>
          <option value="spice">SPICE</option>
        </select>
      </div>
    </div>
  );
};

export default CreateVMWizard;